using System.Web;
using LinkPointTransaction;
using System.Text;
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Collections.Specialized;
using System.Configuration;
using SiteManager;
using System.Data.SqlClient;

public partial class Doctor_unStatus : System.Web.UI.Page
{
    private void Page_Load(object sender, System.EventArgs e)
    {
        // Put user code to initialize the page here
        Manager mgr = new Manager(true,"ConnectionString");

        HttpBrowserCapabilities bc = Request.Browser;
        fIE5 = (bc.Browser == "IE" && bc.MajorVersion > 4);

        order = (string)Session["outXml"];
        resp = (string)Session["resp"];
        ParseResponse(resp);
        if (R_Approved == "APPROVED")
        {

            string delSql = "delete from doctorsubscription where DoctorId=" + Session["userID"];
            mgr.ExecuteScalarQuery(delSql);

            lblMsg.Text = "Your Subscription is Cancelled.";
            lblMsg.ForeColor = System.Drawing.Color.Red;
            lblMsg.Font.Bold = true;
            lblMsg.Font.Size = 10;
        }
        else
        {
            lblMsg.Text = R_Error;
        }
        //// We need LPTxn to display version info
        //LPTxn = new LinkPointTxn();
    }
    protected void ParseResponse(string rsp)
    {
        R_Time = ParseTag("r_time", rsp);
        R_Ref = ParseTag("r_ref", rsp);
        R_Approved = ParseTag("r_approved", rsp);
        R_Code = ParseTag("r_code", rsp);
        R_Authresr = ParseTag("r_authresronse", rsp);
        R_Error = ParseTag("r_error", rsp);
        R_OrderNum = ParseTag("r_ordernum", rsp);
        R_Message = ParseTag("r_message", rsp);
        R_Score = ParseTag("r_score", rsp);
        R_TDate = ParseTag("r_tdate", rsp);
        R_AVS = ParseTag("r_avs", rsp);
        R_Tax = ParseTag("r_tax", rsp);
        R_Shipping = ParseTag("r_shipping", rsp);
        R_FraudCode = ParseTag("r_fraudCode", rsp);
        R_ESD = ParseTag("esd", rsp);
    }
    protected string ParseTag(string tag, string rsp)
    {
        StringBuilder sb = new StringBuilder(256);
        sb.AppendFormat("<{0}>", tag);
        int len = sb.Length;
        int idxSt = -1, idxEnd = -1;
        if (-1 == (idxSt = rsp.IndexOf(sb.ToString())))
        { return ""; }
        idxSt += len;
        sb.Remove(0, len);
        sb.AppendFormat("</{0}>", tag);
        if (-1 == (idxEnd = rsp.IndexOf(sb.ToString(), idxSt)))
        { return ""; }
        return rsp.Substring(idxSt, idxEnd - idxSt);
    }
    protected LinkPointTxn LPTxn;
    protected string order;
    protected string resp;
    protected bool fIE5;
    protected string R_Time;
    protected string R_Ref;
    protected string R_Approved;
    protected string R_Code;
    protected string R_Authresr;
    protected string R_Error;
    protected string R_OrderNum;
    protected string R_Message;
    protected string R_Score;
    protected string R_TDate;
    protected string R_AVS;
    protected string R_FraudCode;
    protected string R_ESD;
    protected string R_Tax;
    protected string R_Shipping;

}
